package com.team2.outpatient_sys.dao;

import com.team2.outpatient_sys.pojo.Supplement;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface SupplementDao {
    @Insert("insert into supplement values(null,#{medicineName},#{cont},#{brand},'否')")
    Integer add(Supplement supplement);

    @Select("select * from supplement where state = '否'")
    List<Supplement> findAll();

    @Update("update supplement set state = '是' where id = #{id}")
    Integer updateSupplement(Integer id);

    @Update("update supplement set medicine_name=#{medicineName},cont=#{cont} where id = #{id}")
    Integer update(Supplement supplement);
}
